# coding=utf8
import moviepy.editor as mp
import os


def parse(file_path):
    for name in os.listdir(file_path):
        if "mp3" in name:
            continue
        if name == "bawangbieji.mp4":
            continue
        file_ = os.path.join(file_path, name)
        file_name = os.path.basename(file_).split(".")[0]
        # print os.path.split(file_path)
        clip = mp.VideoFileClip(file_)
        clip.audio.write_audiofile(os.path.join(file_path, "%s.mp3" % file_name))

parse(r"C:\xiqu\qinqiang1")